package com.dkd.flow.emums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.baomidou.mybatisplus.annotation.IEnum;

import java.util.Arrays;
/**
 * 任务类型 1:审批  2:抄送
 */
public enum TaskType implements IEnum<Integer> {
    // 0:发起 1:审批  2:抄送
    INITIATOR_TASK(1, "发起人任务"),
    APPROVER_TASK(2, "审批人任务"),
    CC_TASK(3, "抄送人任务"),
    TRANSFER_TASK(4, "转交人任务");
    @EnumValue
    private final Integer value;
    private final String name;
    TaskType(Integer value, String name) {
        this.value = value;
        this.name = name;
    }
    @Override
    @JsonValue
    public Integer getValue() {
        return value;
    }
    public String getName() {
        return name;
    }
    public static TaskType getTaskTypeByValue(Integer value) {
        return Arrays.stream(TaskType.values())
                .filter(fv -> fv.value.equals(value))
                .findFirst()
                .orElse(null);
    }
}
